package com.lzy.pattern.prototype.deepclone;

import java.io.*;

/**
 * @ClassName: Client
 * @Description: 深克隆
 * @Author: LiuZy
 * @Date: 2022/4/17 21:47
 * @Version: 1.0
 */
public class Client {
    public static void main(String[] args) throws CloneNotSupportedException, ClassNotFoundException, InstantiationException, IllegalAccessException, IOException {

        Award award = new Award();
        Student student = new Student();
        student.setName("木丁西");
        award.setStu(student);

        ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream("/Users/lzy/mydata/tmp/b.txt"));
        oos.writeObject(award);

        ObjectInputStream ois = new ObjectInputStream(new FileInputStream("/Users/lzy/mydata/tmp/b.txt"));
        Award award1 = (Award) ois.readObject();
        award1.getStu().setName("刘德华");

        award.show();
        award1.show();
    }

}